#include <iostream>
#include <set>
#include <map>
using namespace std;



int main()
{
	cout << "input different strings" << endl;
	set<string> S;
	string str;
	while(cin >> str)
		S.insert(str);
	set<string>::iterator it;
	cout << "==========================" << endl;
	for(it=S.begin(); it!=S.end(); it++)
		cout << *it << endl;
	cout << "==========================" << endl;
	cin.clear();
	cout << "input strings that can be duplicated" << endl;
	map<string,int> M;
	while(cin >> str)
		M[str]++;
	map<string,int>::iterator map_it;
	cout << "==========================" << endl;
	for(map_it=M.begin(); map_it!=M.end(); map_it++)
		cout << map_it->first << "\t" << map_it->second << endl; 
	cout << "==========================" << endl;
	
	return 0;
}
